package edu.gdkm.dao;

import edu.gdkm.pojo.Users;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository   //@Component ->数据应用层@Repository
public interface IUsersDao {
    @Insert("insert into users value(null,#{name},#{pwd})")
    @Options(useGeneratedKeys=true, keyProperty="uid", keyColumn="uid")
    public Integer insertUsers(Users users);
    @Update("update users set name=#{name},pwd=#{pwd} where uid=#{uid}")
    public Integer updateUsers(Users users);
    @Delete("delete from users where uid=#{uid}")
    public Integer delUsersByUid(Integer uid);
    @Select("select * from users where uid=#{uid}")
    public Users getUsersByUid(Integer uid);
    @Select("select * from users")
    public List<Users> getUsersList();
    @Select("select count(*) from users")
    public long getUsersCount();
    @Select("select * from users where name=#{name} and pwd=#{pwd}")
    public Users login(@Param("name") String name, @Param("pwd") String pwd);
}
